<?php
session_start();
require_once 'Util.php';
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Session
 *
 * @author gurzaf
 */
class Session {
    public static $_message;

    public static function registrarSesion($usuario){
        $_SESSION["user"] = $usuario;
    }

    public static function verificarSesion($redirect){
        if(!isset($_SESSION["user"]) || $_SESSION["user"]==""){
            if($redirect)
                Util::redireccionar("/form_login.php?message=No+existe+la+sesion");
            else
                return false;
        }else
            return true;
    }

    public static function terminarSesion(){
        if(session_destroy())
            Util::redireccionar("form_login.php?message=Sesion+cerrada+con+exito");
        else
            Util::redireccionar("form_login.php?message=Error+cerrando+la+sesion");
    }
}
